

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>CephFS Top Utility &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/underscore.js"></script>
        <script src="../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="Snapshot Scheduling Module" href="../snap-schedule/" />
    <link rel="prev" title="升级 MDS 集群" href="../upgrading/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../">Ceph 文件系统</a> &raquo;</li>
        
      <li>CephFS Top Utility</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../_sources/cephfs/cephfs-top.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../">
          

          
            
            <img src="../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Ceph 文件系统</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../#cephfs">CephFS 入门</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../#id4">管理</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../createfs/"> 创建 CephFS 文件系统</a></li>
<li class="toctree-l3"><a class="reference internal" href="../administration/"> 管理命令</a></li>
<li class="toctree-l3"><a class="reference internal" href="../multifs/"> 创建多个文件系统</a></li>
<li class="toctree-l3"><a class="reference internal" href="../add-remove-mds/"> 配备、增加、删除 MDS</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/">术语</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#mds">MDS 守护进程的引用</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#id3">故障切换的管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#mds-standby-replay">热备的配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#mds-join-fs">配置 MDS 与文件系统的亲和性</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cache-configuration/"> MDS 缓存配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mds-config-ref/"> MDS 配置选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../man/8/ceph-mds/"> ceph-mds 手册页</a></li>
<li class="toctree-l3"><a class="reference internal" href="../nfs/"> 通过 NFS 导出</a></li>
<li class="toctree-l3"><a class="reference internal" href="../app-best-practices/"> 应用最佳实践</a></li>
<li class="toctree-l3"><a class="reference internal" href="../fs-volumes/"> FS 卷和子卷</a></li>
<li class="toctree-l3"><a class="reference internal" href="../quota/"> CephFS 配额管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../health-messages/"> 健康消息</a></li>
<li class="toctree-l3"><a class="reference internal" href="../upgrading/">升级 MDS 集群</a></li>
<li class="toctree-l3"><a class="reference internal" href="../upgrading/#firefly-jewel">升级比 Firefly 老的文件系统，需过 Jewel 这个槛</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#"> CephFS Top 工具</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#manager-plugin">Manager Plugin</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id1"><cite>cephfs-top</cite></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../snap-schedule/"> 定时快照</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cephfs-mirroring/"> CephFS 快照镜像</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../#id5">挂载 CephFS</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id6">CephFS 内幕</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id7">故障排除和灾难恢复</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id9">更多细节</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="cephfs-top-utility">
<span id="cephfs-top"></span><h1>CephFS Top Utility<a class="headerlink" href="#cephfs-top-utility" title="Permalink to this headline">¶</a></h1>
<p>CephFS provides <cite>top(1)</cite> like utility to display various Ceph Filesystem metrics
in realtime. <cite>cephfs-top</cite> is a curses based python script which makes use of <cite>stats</cite>
plugin in Ceph Manager to fetch (and display) metrics.</p>
<div class="section" id="manager-plugin">
<h2>Manager Plugin<a class="headerlink" href="#manager-plugin" title="Permalink to this headline">¶</a></h2>
<p>Ceph Filesystem clients periodically forward various metrics to Ceph Metadata Servers (MDS)
which in turn get forwarded to Ceph Manager by MDS rank zero. Each active MDS forward its
respective set of metrics to MDS rank zero. Metrics are aggregated and forwarded to Ceph
Manager.</p>
<p>Metrics are divided into two categories - global and per-mds. Global metrics represent
set of metrics for the filesystem as a whole (e.g., client read latency) whereas per-mds
metrics are for a particular MDS rank (e.g., number of subtrees handled by an MDS).</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Currently, only global metrics are tracked.</p>
</div>
<p><cite>stats</cite> plugin is disabled by default and should be enabled via:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph mgr module enable stats
</pre></div>
</div>
<p>Once enabled, Ceph Filesystem metrics can be fetched via:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph fs perf stats
{&quot;version&quot;: 1, &quot;global_counters&quot;: [&quot;cap_hit&quot;, &quot;read_latency&quot;, &quot;write_latency&quot;, &quot;metadata_latency&quot;, &quot;dentry_lease&quot;], &quot;counters&quot;: [], &quot;client_metadata&quot;: {&quot;client.614146&quot;: {&quot;IP&quot;: &quot;10.1.1.100&quot;, &quot;hostname&quot;  : &quot;ceph-host1&quot;, &quot;root&quot;: &quot;/&quot;, &quot;mount_point&quot;: &quot;/mnt/cephfs&quot;, &quot;valid_metrics&quot;: [&quot;cap_hit&quot;, &quot;read_latency&quot;, &quot;write_latency&quot;, &quot;metadata_latency&quot;, &quot;dentry_lease&quot;]}}, &quot;global_metrics&quot;: {&quot;client.614146&quot;: [[0,  0], [0, 0], [0, 0], [0, 0], [0, 0]]}, &quot;metrics&quot;: {&quot;delayed_ranks&quot;: [], &quot;mds.0&quot;: {&quot;client.614146&quot;: []}}}
</pre></div>
</div>
<p>Details of the JSON command output are as follows:</p>
<ul class="simple">
<li><p><cite>version</cite>: Version of stats output</p></li>
<li><p><cite>global_counters</cite>: List of global performance metrics</p></li>
<li><p><cite>counters</cite>: List of per-mds performance metrics</p></li>
<li><p><cite>client_metadata</cite>: Ceph Filesystem client metadata</p></li>
<li><p><cite>global_metrics</cite>: Global performance counters</p></li>
<li><p><cite>metrics</cite>: Per-MDS performance counters (currently, empty) and delayed ranks</p></li>
</ul>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p><cite>delayed_ranks</cite> is the set of active MDS ranks that are reporting stale metrics.
This can happen in cases such as (temporary) network issue between MDS rank zero
and other active MDSs.</p>
</div>
<p>Metrics can be fetched for a partcilar client and/or for a set of active MDSs. To fetch metrics
for a particular client (e.g., for client-id: 1234):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph fs perf stats --client_id=1234
</pre></div>
</div>
<p>To fetch metrics only for a subset of active MDSs (e.g., MDS rank 1 and 2):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph fs perf stats --mds_rank=1,2
</pre></div>
</div>
</div>
<div class="section" id="id1">
<h2><cite>cephfs-top</cite><a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
<p><cite>cephfs-top</cite> utility relies on <cite>stats</cite> plugin to fetch performance metrics and display in
<cite>top(1)</cite> like format. <cite>cephfs-top</cite> is available as part of <cite>cephfs-top</cite> package.</p>
<p>By default, <cite>cephfs-top</cite> uses <cite>client.fstop</cite> user to connect to a Ceph cluster:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph auth get-or-create client.fstop mon &#39;allow r&#39; mds &#39;allow r&#39; osd &#39;allow r&#39; mgr &#39;allow r&#39;
$ cephfs-top
</pre></div>
</div>
<p>To use a non-default user (other than <cite>client.fstop</cite>) use:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ cephfs-top --id &lt;name&gt;
</pre></div>
</div>
<p>By default, <cite>cephfs-top</cite> connects to cluster name <cite>ceph</cite>. To use a non-default cluster name:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ cephfs-top --cluster &lt;cluster&gt;
</pre></div>
</div>
<p><cite>cephfs-top</cite> refreshes stats every second by default. To choose a different refresh interval use:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ cephfs-top -d &lt;seconds&gt;
</pre></div>
</div>
<p>Interval should be greater than or equal to 0.5 seconds. Fractional seconds are honoured.</p>
<p>Sample screenshot running <cite>cephfs-top</cite> with 2 clients:</p>
<img alt="../../_images/cephfs-top.png" src="../../_images/cephfs-top.png" />
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>As of now, <cite>cephfs-top</cite> does not reliably work with multiple Ceph Filesystems.</p>
</div>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../snap-schedule/" class="btn btn-neutral float-right" title="Snapshot Scheduling Module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../upgrading/" class="btn btn-neutral float-left" title="升级 MDS 集群" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>